package com.hl.springcloud.controller;

import com.hl.springcloud.pojo.Dept;
import com.hl.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author Liu Huan
 */
@RestController
public class DeptConsumerController {
	
	// 对比之前的  RestTemplete  !!!
	@Autowired
	private DeptClientService deptClientService;
	
	@RequestMapping("/consumer/dept/get/{id}")
	public Dept get(@PathVariable("id") Long id){
		return deptClientService.queryById(id);
	}
	
	@RequestMapping("/consumer/dept/add")
	public boolean addDept(Dept dept){
		return deptClientService.addDept(dept);
	}
	
	@RequestMapping("/consumer/dept/get/list")
	public List<Dept> list(){
		return deptClientService.queryAll();
	}
	
}
